//
//  EpointTestVcViewController.m
//  EpointFrame5
//
//  Created by 李亚春 on 13-12-4.
//  Copyright (c) 2013年 Epoint. All rights reserved.
//

#import "EpointTestVcViewController.h"

@interface EpointTestVcViewController ()
{
    int testTaskId;
}
@end

@implementation EpointTestVcViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        testTaskId = 1;
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
//    if( ([[[UIDevice currentDevice] systemVersion] doubleValue]>=7.0))
//    {
//        self.edgesForExtendedLayout= UIRectEdgeNone;
//    }
    self.title = @"登录";
    UIButton *bt = [[UIButton alloc]initWithFrame:CGRectMake(10, 10, self.view.frame.size.width-20, 100)];
    [bt setBackgroundColor:[UIColor redColor]];
    [bt setTitle:@"TEST" forState:UIControlStateNormal];
    [bt setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [bt setTitleColor:[UIColor grayColor] forState:UIControlStateHighlighted];
    [bt addTarget:self action:@selector(btclick) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:bt];
}

-(void)btclick
{
    NSLog(@"Click!!!!");
    [self exeTestTask];
}

-(void)exeTestTask
{
    NSMutableDictionary *params = [[NSMutableDictionary alloc]init];
    [params setObject:@"阿拉丁de梦" forKey:@"name"];
    [self startTask:@"TestTask" withParams:params withTaskId:testTaskId];
    [self showMBPHUD];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)refreshUIWithThreadGuid:(int)taskId andData:(NSObject *)obj
{
    if (taskId==testTaskId)
    {
        [self hideMBPHUD];
        [self toastMessage:(NSString *)obj];
    }
}

@end
